package com.cat.model.common.util;

import java.io.File;

import com.alonew.core.commons.tuple.TwoTuple;

public class UploadFileManager {
	
	public static String saveFile(File file, String filedataName){
		String imagePath = StaticFileUtil.richRelativePath() + FileUtil.buildDatePath();
		TwoTuple<String, byte[]> md5AndData = FileUtil.readAndCalMd5(file);
		
		FileUtil.writeFile(StaticFileUtil.staticRootPath() + imagePath, filedataName, md5AndData.second);
		return ImageUtil.wrapImageUrl(imagePath + "/" + filedataName);
	}
}
